/**
 * @Auther: ChenforCode
 * @Date: 2018/9/12 00:41
 * @Description: 完成与注册相关的业务逻辑
 */
package cn.chenforcode.service;

import cn.chenforcode.dao.StudentDAO;
import cn.chenforcode.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RegisterService {

    @Autowired
    private StudentDAO studentDAO;

    /**
     * @return java.lang.String
     * @Author ChenforCode
     * @Description //TODO 完成注册操作
     * @Date 0:44 2018/9/12
     * @Param [student]
     **/
    public String doRegister(Student student) {
        if (studentDAO.queryCanAdd(student.getSno()) == 1) {
            studentDAO.addStudent(student);
            return "success";
        } else {
            return "failed";
        }
    }
}
